﻿var mysql = require('mysql');

var mysqlhelper = {};
var pool = mysql.createPool({
    connectionLimit: 10,
    host: 'dataxiu.com',
    user: 'root',
    password: 'dataxiu~1',
    database: 'vispan'
});

mysqlhelper.query = function (sql, pars, callback) {

    if (!sql) {
        callback();
        return;
    }
    pool.query(sql, pars, function (err, rows, fields) {
        if (err) {
            console.log(err);
            callback(err, null);
            return;
        };

        callback(null, rows, fields);
    });
}
module.exports = mysqlhelper;  